﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DAL;
public partial class EditProTypeInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        //Frame.Global.GlobalFunctions.SetGridView(gvProTypeInfo, true);
    }
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        
    }
    protected void gvProTypeInfo_RowCommand(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewRowCommandEventArgs e)
    {
        using (DataClassesDataContext lqDB = new DataClassesDataContext())
        {
            int id = Convert.ToInt32(e.KeyValue);
            TypeInfo type = lqDB.TypeInfo.FirstOrDefault(t => t.Type_ID == id);
            lqDB.TypeInfo.DeleteOnSubmit(type);
            lqDB.SubmitChanges();
            Frame.Global.GlobalFunctions.AlertToUrl("删除成功！", "EditProTypeInfo.aspx");
            //this.gvProTypeInfo.DataSourceID = "";
            //this.gvProTypeInfo.DataSource = Frame.Global.GlobalSqlHelper.ExecuteSQL("select * from TypeInfo");
        }
    }
}